package org.demo.base.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.demo.domain.person.Person;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.stereotype.Component;

@Component
public class PersonRowMapper implements ParameterizedRowMapper<Person> {

	@Override
	public Person mapRow(ResultSet resultSet, int rowNum) throws SQLException {
		Person person = new Person();
		person.setId((new Long(resultSet.getInt("ID"))));
		person.setFirstName(resultSet.getString("FIRSTNAME"));
		person.setLastName(resultSet.getString("LASTNAME"));
		return person;
	}

}
